# ALTERNATIVE: local su ident will always work (but dangerous!)
# PG_EXPORTER_URL='postgres:///postgres{% if pg_exporter_params != '' %}?{{ pg_exporter_params }}{% endif %}'
{% if pg_exporter_url != '' %}
# OVERWRITE by pg_exporter_url
PG_EXPORTER_URL='{{ pg_exporter_url }}'
{% else %}
PG_EXPORTER_URL='postgres://{{ pg_monitor_username }}:{{ pg_monitor_password }}@:{{ pg_port }}/postgres{% if pg_exporter_params != '' %}?{{ pg_exporter_params }}{% if pg_localhost != '' %}&host={{ pg_localhost }}{% endif %}{% endif %}'
{% endif %}
{% if pg_exporter_auto_discovery|bool %}
PG_EXPORTER_AUTO_DISCOVERY=true
{% else %}
PG_EXPORTER_AUTO_DISCOVERY=false
{% endif %}
PG_EXPORTER_EXCLUDE_DATABASE="{{ pg_exporter_exclude_database|default('template0,template1,postgres') }}"
PG_EXPORTER_INCLUDE_DATABASE="{{ pg_exporter_include_database|default('') }}"
PG_EXPORTER_CONFIG=/etc/pg_exporter.yml
PG_EXPORTER_TELEMETRY_PATH="{{ exporter_metrics_path }}"
PG_EXPORTER_DISABLE_CACHE=false
PG_EXPORTER_CONNECT_TIMEOUT={{ pg_exporter_connect_timeout }}
{% if pg_exporter_options != '' %}
PG_EXPORTER_OPTS='--web.listen-address=:{{ pg_exporter_port }} {{ pg_exporter_options }}'
{% else %}
PG_EXPORTER_OPTS='--web.listen-address=:{{ pg_exporter_port }} --log.level=info'
{% endif %}